<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of alvoDAO
 *
 * @author Imperius
 */
class alvoDAO {

    public function inserir($user){
        $mongoDB = new Mongo();
        $db = $mongoDB->apiTwitter;
        $alvos = $db->alvo;
        $insert;
        $subInsert;
        foreach($user as $propriedade => $valor){
            if($valor instanceof  stdClass){
                foreach($valor as $prop => $val){
                    $subInsert[$prop]=$val;
                }
                $insert[$propriedade]=$subInsert;
            }else{
                $insert[$propriedade]=$valor;
            }
        }
        $alvos->insert($insert);
    }
    public function recuperar(){
        $mongoDB = new Mongo();
        $db = $mongoDB->apiTwitter;
        $alvos = $db->alvo;
        return $alvos->find();
    }
}
?>
